package com.example.schooljava.mapper;

import com.example.schooljava.pojo.bo.ClassBO;
import com.example.schooljava.pojo.entity.Class;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.schooljava.pojo.entity.Teacher;
import com.example.schooljava.pojo.vo.ClassVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author LDH
 * @since 2022/08/11
 */
@Mapper
public interface ClassMapper extends BaseMapper<Class> {
    List<ClassVO> getClass(ClassBO classBO);

    @Select("SELECT tno,teacher.name name\n" +
            "FROM teacher LEFT JOIN class ON tno=headmaster\n" +
            "WHERE headmaster IS NULL")
    List<Teacher> getHeadmaster();

    @Select("SELECT tno,teacher.name name\n" +
            "FROM teacher LEFT JOIN class ON tno=assistant\n" +
            "WHERE assistant IS NULL")
    List<Teacher> getAssistant();

    @Select("SELECT DISTINCT name FROM class")
    List<Integer> getAllClass();
}
